package tec;

import java.util.ArrayList;
import java.util.List;

public class CollecteMem implements Collecte{
	
	int arret;
	List<Arret> collected;
	Arret current;
	
	class Arret{
		public int arret;
		public int nbSorties;
		public int nbEntrees;
		
		public Arret() {
			nbSorties=0;
			nbEntrees=0;
			arret = 0;
		}
		public Arret(int arret) {
			this();
			this.arret = arret;
		}
		public String toString()
		{
			return  "Arret: "+ arret +", NbEntrees: "+ nbEntrees+", NbSorties: "+ nbSorties; 
		}
	}
	
	public CollecteMem()
	{
		arret = 0;
		collected = new ArrayList<Arret> ();
		current = new Arret(arret);
	}
	
	public void uneEntree()
	{
		current.nbEntrees++;
	}
	
	public void uneSortie()
	{
		current.nbSorties++;
	}
	
	public void changerArret()
	{
		collected.add(current);
		arret++;
		current = new Arret(arret);
	}

	public void printCollected() {
		for(Arret arrCur : collected){
			System.out.println(arrCur.toString());
		}
	}
}
